package com.zqxq.lottery.mapper.user;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.zqxq.lottery.entity.bo.user.UserInfoCMSBO;
import com.zqxq.lottery.entity.po.user.UserAgentPO;
import com.zqxq.lottery.entity.po.user.UserInfoPO;
import com.zqxq.lottery.entity.vo.user.UserInfoCMSVO;
import com.zqxq.lottery.entity.vo.user.UserInfoVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component(value = "userAgentMapper")
public interface UserAgentMapper extends BaseMapper<UserAgentPO> {

    Map<String,Object> queryTotalAgentDataById(@Param("userId") Long userId,@Param("month") String month);

    Map<String,Object> queryRegUserDataById(@Param("userId") Long userId,@Param("month") String month);

    List<Map<String,Object>> queryDayAgentDataById(Page<Map<String,Object>> page,@Param("userId") Long userId,@Param("month") String month);

    List<Map<String,Object>> queryMonthAgentDataById(Page<Map<String,Object>> page,@Param("userId") Long userId,@Param("month") String month);

    Map<String,Object> getAllAgentOrderData(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("agentId") String agentId);

    Map<String,Object> getAllAgentUserData(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("agentId") String agentId);

    @Select("select name,agent_id from user_agent where status=0")
    List<Map<String,String>> selectAgentNameList();

    List<Map<String,Object>> queryDayManageData(Page<Map<String,Object>> page,@Param("startTime") String startTime,
                                                @Param("endTime") String endTime,@Param("agentId") String agentId);

    List<Map<String,Object>> queryMonthManageData(Page<Map<String,Object>> page,@Param("startTime") String startTime,
                                                  @Param("endTime") String endTime,@Param("agentId") String agentId);

    @Select("select * from user_agent where user_id=#{userId} and `status`=0")
    UserAgentPO selectAgentById(@Param("userId") Long userId);

    @Select("select GROUP_CONCAT(user_id SEPARATOR ',') from user_agent where `status`=0")
    String selectAgentList();
}
